include( "PP_Shared.lua" )


InfoP = nil
OldENT = nil

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drawing information here
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
function DCMessHook( um )
	GAMEMODE:AddNotify( um:ReadString() .. "'s entities will be removed in " .. RemovePropsDelay .. " seconds.", NOTIFY_GENERIC, 5 )
	surface.PlaySound( "HL1/fvox/fuzz.wav" )
end
usermessage.Hook( "DCMessage", DCMessHook )

function RemoveMessHook( um )
	GAMEMODE:AddNotify( um:ReadString() .. "'s entities removed.", NOTIFY_GENERIC, 5 )
	surface.PlaySound( "HL1/fvox/fuzz.wav" )
end
usermessage.Hook( "RemoveMessage", RemoveMessHook )

function IdleMessHook( um )
	GAMEMODE:AddNotify( um:ReadString() .. " was kicked for idling.", NOTIFY_GENERIC, 5 )
	surface.PlaySound( "HL1/fvox/fuzz.wav" )
end
usermessage.Hook( "IdleMessage", IdleMessHook )

function DrawInfo()
	if LocalPlayer() and LocalPlayer():IsValid() then
		local ENT = LocalPlayer():GetEyeTrace().Entity
		local OWN = ENT:GetNWEntity( "clOwner" )
	
		if ENT and !ENT:IsPlayer() and ENT:IsValid() and OldENT == nil and InfoP == nil then
			InfoP = vgui.Create( "PPInfo" )
				if OWN and OWN:IsValid() and OWN:IsPlayer() then
					InfoP.OWNTEXT = OWN:Nick()
				else
					InfoP.OWNTEXT = "No Owner"
				end
				OldENT = ENT
		elseif (!ENT or !ENT:IsValid() or ENT != OldENT) and InfoP != nil then
			InfoP:Remove()
			InfoP = nil
			OldENT = nil
		end
	end
	
end
hook.Add( "Tick", "DrawInfo", DrawInfo )